<script src="<?php echo base_url()?>/public/assets/js/laydate/laydate.js" type="text/javascript"></script>
<div class="row">
	<div class="col-sm-12">
	    <div>
    		<a href="/admin/teacher?per_page=<?php if(!empty($_REQUEST['per_page']))echo $_REQUEST['per_page']?>" class="btn btn-sm">返回</a>
    	</div>
		<div class="space"></div>
        <form action="/admin/teacher/update" method="post" onsubmit="return yanzheng()">
		<input type="hidden" value="update" name="form_submit" />
		<input type="hidden" value="<?php echo $teacher_info['id']?>" name="id" />
		<table width="100%" class="table table-striped table-bordered table-hover" widtd="100%">
			<tr>
			  <td height="30" widtd="15%">园所：</td>
			  <td height="30" align="left" widtd="85%"><select name="nursery_id">
                <?php foreach ($nursery_list as $val){?>
                <option value="<?php echo $val['id']?>"><?php echo $val['title']?></option>
                <?php }?>
              </select></td>
		  </tr>
			<tr>
			    <td width="15%" height="30" widtd="15%">姓名：</td>
				<td width="85%" height="30" align="left" widtd="85%"><input type="text" value="<?php echo $teacher_info['name']?>" name="name"/></td>
			</tr>
			<tr>
			  <td height="30">头像：</td>
			  <td height="30" align="left">
			  <img src="<?php echo $teacher_info['avatar']?>" width='100px' />			  </td>
		  </tr>
			<tr>
			  <td height="30">性别：</td>
			  <td height="30" align="left">
			  <select name="sex">
			  	<option value="1">男</option>
			  	<option value="0">女</option>
			  </select>			  </td>
		  </tr>
			<tr>
			  <td height="30">手机号：</td>
			  <td height="30" align="left"><input type="text" value="<?php echo $teacher_info['mobile']?>" name="mobile" onkeyup='this.value=this.value.replace(/\D/gi,"")'/></td>
		  </tr>
		  <tr>
			  <td height="30">上课次数：</td>
			  <td height="30" align="left"><input type="text" value="<?php echo $teacher_info['book_num']?>" name="book_num" onkeyup='this.value=this.value.replace(/\D/gi,"")'/></td>
		  </tr>
			<tr>
			  <td height="30">简介：</td>
			  <td height="30" align="left">
			  <textarea name="explain" style="width:400px"><?php echo $teacher_info['explain']?></textarea></td>
		  </tr>
			<tr>
			  <td height="30" colspan="2"><div align="center"><input class="btn btn-info btn-sm" type="submit" value="提交" /></div></td>
		  </tr>
	  </table>
	  </form>
	</div>
</div>
<script>
$("[name='sex']").val(<?php echo $teacher_info['sex']?>);
$("[name='nursery_id']").val(<?php echo $teacher_info['nursery_id']?>);
function yanzheng(){ 
	if(!$("[name='name']").val()){ 
	    alert('请输入名称！'); 
	    return false; 
	}
	var myreg = /^(((1[1-9]{1}))+\d{9})$/; 
	if(!myreg.test($("[name='mobile']").val())){ 
	    alert('请输入有效的手机号码！'); 
	    return false; 
	}
	if(!$("[name='explain']").val()){ 
	    alert('请输入简介！'); 
	    return false; 
	}
	if(!confirm('确定要修改吗？')){
		return false;
	}
}
function getcourselist(id){
		$.ajax({
    	    type : "get", 
    	    async:false, 
    	    url : "/admin/coursepackage/getcourselist?course_cate_id="+id, 
    	    dataType : "json", 
    	    success : function(data){
    		    if(data['code'] == 10){
    		    	var content = '';
    		    	var list = data['list'];
    		    	for(var i=0;i<list.length;i++){
    		    		content+= '<option value="'+list[i]['id']+'">'+list[i]['title']+'</option>';
    			    }
    			    $("[name='course_list_id']").html(content);
    			}else{
    				alert(data['msg']);
    			}
    	    }, 
    	    error:function(){
    	        alert('fail'); 
    	    } 
	});
}
</script>
<!--content-->